package com.lxh.lxhcrm.model.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.util.List;
import java.util.Objects;

/**
 * 出库表
 */
@Entity
public class OutWare {
    private int outId;
    private String outDan;
    private Date outDate;
    private Integer state;
    private String remark;
    private String conDan;
    private String principal;
    private String deliveryTime;
    private Integer deliveryPlanId;

    private Emp emp;
    private List<WareDetail> wareDetail;

    @OneToMany(mappedBy = "outWare")
    public List<WareDetail> getWareDetail() {
        return wareDetail;
    }

    public void setWareDetail(List<WareDetail> wareDetail) {
        this.wareDetail = wareDetail;
    }

    @ManyToOne
    @JoinColumn(name="emp_id",referencedColumnName = "emp_id")
    public Emp getEmp() {
        return emp;
    }

    public void setEmp(Emp emp) {
        this.emp = emp;
    }

    @Id
    @Column(name = "out_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public int getOutId() {
        return outId;
    }

    public void setOutId(int outId) {
        this.outId = outId;
    }

    @Basic
    @Column(name = "out_date", nullable = true)
    public Date getOutDate() {
        return outDate;
    }

    public void setOutDate(Date outDate) {
        this.outDate = outDate;
    }

    @Basic
    @Column(name = "remark", nullable = true, length = 200)
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Basic
    @Column(name = "out_dan", nullable = true)
    public String getOutDan() {
        return outDan;
    }

    public void setOutDan(String outDan) {
        this.outDan = outDan;
    }

    @Basic
    @Column(name = "state", nullable = true)
    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    @Basic
    @Column(name = "con_dan", nullable = true)
    public String getConDan() {
        return conDan;
    }

    public void setConDan(String conDan) {
        this.conDan = conDan;
    }

    @Basic
    @Column(name = "delivery_plan_id", nullable = true)
    public Integer getDeliveryPlanId() {
        return deliveryPlanId;
    }

    public void setDeliveryPlanId(Integer deliveryPlanId) {
        this.deliveryPlanId = deliveryPlanId;
    }

    @Basic
    @Column(name = "principal", nullable = true)
    public String getPrincipal() {
        return principal;
    }

    public void setPrincipal(String principal) {
        this.principal = principal;
    }

    @Basic
    @Column(name = "delivery_time", nullable = true)
    public String getDeliveryTime() {
        return deliveryTime;
    }

    public void setDeliveryTime(String deliveryTime) {
        this.deliveryTime = deliveryTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        OutWare outWare = (OutWare) o;
        return outId == outWare.outId &&
                Objects.equals(outDan, outWare.outDan) &&
                Objects.equals(outDate, outWare.outDate) &&
                Objects.equals(state, outWare.state) &&
                Objects.equals(remark, outWare.remark) &&
                Objects.equals(conDan, outWare.conDan) &&
                Objects.equals(principal, outWare.principal) &&
                Objects.equals(deliveryTime, outWare.deliveryTime) &&
                Objects.equals(deliveryPlanId, outWare.deliveryPlanId) &&
                Objects.equals(emp, outWare.emp) &&
                Objects.equals(wareDetail, outWare.wareDetail);
    }

    @Override
    public int hashCode() {
        return Objects.hash(outId, outDan, outDate, state, remark, conDan, principal, deliveryTime, deliveryPlanId, emp, wareDetail);
    }
}
